package com.soulkun.smarthome.ui.main.home.popup

import android.Manifest
import android.content.Context
import android.content.pm.PackageManager
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Build
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.PopupWindow
import androidx.databinding.DataBindingUtil
import com.soulkun.smarthome.R
import com.soulkun.smarthome.databinding.AppPopupMainHomeAddBinding
import com.soulkun.smarthome.databinding.AppPopupMainHomeDeviceMenuBinding
import com.soulkun.smarthome.ui.main.home.AppMainHomeDeviceFragment
import com.soulkun.smarthome.ui.main.home.AppMainHomeFragment
import soulkun.library.utils.toPx

class AppMainHomeDeviceMenuPopupWindow(
    context: Context,
    onClickListener: (AppMainHomeDeviceMenuPopupWindow) -> View.OnClickListener
) : PopupWindow(context) {

    private val mBinding: AppPopupMainHomeDeviceMenuBinding = DataBindingUtil.inflate(
        LayoutInflater.from(context),
        R.layout.app_popup_main_home_device_menu,
        null,
        false
    )

    init {
        contentView = mBinding.root
        setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
        mBinding.onClickListener = onClickListener(this)
        width = context.resources.getDimensionPixelSize(R.dimen.sw_120dp)
        height = ViewGroup.LayoutParams.WRAP_CONTENT
        isFocusable = true
        isOutsideTouchable = true
    }

}